# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libwebp
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.5.0
pkgrel=1
pkgdesc="the WebP library. Includes conversion tools (mingw-w64)"
arch=('any')
url="https://developers.google.com/speed/webp/"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-giflib"
         "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
         "${MINGW_PACKAGE_PREFIX}-libpng"
         "${MINGW_PACKAGE_PREFIX}-libtiff")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=(http://downloads.webmproject.org/releases/webp/${_realname}-${pkgver}.tar.gz{,.asc})
sha256sums=('5cd3bb7b623aff1f4e70bd611dc8dbabbf7688fd5eb225b32e02e09e37dfb274'
            'SKIP')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  mkdir -p ${srcdir}/${MINGW_CHOST}
  cd "${srcdir}/${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-static \
    --enable-swap-16bit-csp \
    --enable-experimental \
    --enable-libwebpmux \
    --enable-libwebpdemux \
    --enable-libwebpdecoder

  make -j1
}

package() {
  cd "${srcdir}/$MINGW_CHOST"
  make install DESTDIR="${pkgdir}"
}
